#include "QtForOpenCV4Tool.h"

QtForOpenCV4Tool::QtForOpenCV4Tool(QWidget* parent)
	: QMainWindow(parent)
{

	qRegisterMetaType<cv::Mat>("cv::Mat");
	qRegisterMetaType<cv::Mat*>("cv::Mat*");
	ui.setupUi(this);
	this->resize(QSize(320, 480));
	this->setWindowTitle("OpenCV Tool");
	this->setWindowIcon(QIcon("images/opencv.png"));
	createListView();
}

void QtForOpenCV4Tool::createListView() {
	listView = new CommonListView(this);
	connect(listView, &CommonListView::itemClicked, [=](QListWidgetItem* item) {
		CommonListViewItem* item2 = dynamic_cast<CommonListViewItem*>(item);
		qDebug() << "itemPos:" << item2->mPos;
		switch (item2->mPos) {
		case 10://项目
			multimediaProjectCollectionWindow.show();
			break;
		case 11://OpenCV相关案例
			cvWindow.show();
			break;
		case 12://opengl相关
			openGLSampleWindow.show();
			break;
		case 13://ffmpeg相关
			fFMpegWindow.show();
			break;
		case 14://SDL2相关案例
			sdlWindow.show();
			break;

		}
		});
	new CommonListViewItem("多媒体项目集合", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 10, listView);
	new CommonListViewItem("OpenCV相关案例", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 11, listView);
	new CommonListViewItem("OpenGL相关案例", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 12, listView);
	new CommonListViewItem("FFMPEG相关案例", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 13, listView);
	new CommonListViewItem("SDL2相关案例", QIcon("images/tezhengjiance.png"), QIcon("images/tezhengjiance.png"), 14, listView);


}

QtForOpenCV4Tool::~QtForOpenCV4Tool()
{}
